/*
 * ticketlist.h
 *
 *  Created on: 2013-2-19
 *      Author: panqiuhui
 */

#ifndef TICKETLIST_H_
#define TICKETLIST_H_
#include <stdbool.h>
#include "traininfo.h"

struct ticketinfo {
	char trainID[TRAIN_NUMBER_TRAINID_LEN];
	bool isDepartStation;
	char startStation[STATIONS_STATION_NAME_LEN];
	char startTime[TRAINS_DEPARTTIME_LEN];
	bool isArriveStation;
	char endStation[STATIONS_STATION_NAME_LEN];
	char endTime[TRAINS_ARRIVETIME_LEN];
	char consumeTime[TRAINS_CONSUMETIME_LEN];
	bool isStartSale;
	int ticketLeft;
	char departDate[TRAINS_DEPARTDATE_LEN];
	char price[ORDERS_PRICE];
};

typedef struct ticketinfo TicketItem;

typedef struct ticket_node {
	TicketItem item;
	struct ticket_node *next;
} TicketNode;

typedef TicketNode * TicketList;

void InitializeListTicket(TicketList * plist);

bool ListIsEmptyTicket(const TicketList * plist);

bool ListIsFullTicket(const TicketList * plist);

unsigned int ListItemCountTicket(const TicketList * plist);

bool AddItemTicket(TicketItem item, TicketList *plist);

void TraverseTicket(const TicketList * plist, void (*pfun)(TicketItem item));

void EmptyTheListTicket(TicketList * plist);

#endif /* TICKETLIST_H_ */
